<template>
  <div class="box">
    <div class="container">
      <!--分类宣传图展示-->
      <div class="imgshow">
        <div class="title_top">
          <h2>搜索结果</h2>
          <span> > </span>
          <div>"食不食油饼"</div>
        </div>
        <div class="orde">
          <div>排序:</div>
          <div style="margin: 0 20px;color: orange">
            默认
          </div>
          <div>
            价格:
          </div>
          <div>
            <div class="up"></div>
            <div class="down"></div>
          </div>
          <div style="margin-left: 15px">新品</div>
        </div>
      </div>
      <div style="display: flex;justify-content: space-evenly;padding-bottom:200px">
        <div class="goods-detail" v-if="false">
          <!--骨架屏-->
          <el-skeleton :loading="loading" v-for="(item,index) in 9" :key="index" style="margin: 20px;width: 230px;border:1px solid gainsboro; height:380px;border-radius: 10px"  animated>
            <template #template>
              <el-skeleton-item variant="image" style="width: 230px; height: 228px" />
              <div style="text-align: center;display: flex;flex-direction: column;align-items: center" >
                <el-skeleton-item variant="p" style="width: 50%;margin: 10px" />
                <el-skeleton-item variant="p" style="width: 30%;margin-top: 20px" />
              </div>
              <div style="margin-top: 20px;height: 32px;text-align: center">
                <el-skeleton-item variant="p" style="width: 40%;height: 100%" />
                <el-skeleton-item variant="p" style="width: 40%;height: 100%"  />
              </div>
            </template>
          </el-skeleton>
          <div class="goods-detail-item" v-if="!loading" v-for="(item,index) in 9" :key="index">
            <div class="goods-detail-item-top">
              <img src="http://lixinghe.meimeng.eu.org/flower/image/20141006231606_CrJmu.jpeg" alt="图片走丢了">
            </div>
            <!--商品信息-->
            <div class="goods-info">
              <!--              价格-->
              <div class="price">￥999</div>
              <!--              内容，名字-->
              <div class="title">
                <a >
                  真的爱你
                </a>
              </div>
              <div class="operate">
                <a >
                  <span class="el-icon-star-off"></span>收藏
                </a>
                <a>
                  <span class="el-icon-shopping-cart-2"></span>加入购物车
                </a>
              </div>
            </div>
          </div>
          <el-pagination
              background
              layout="prev, pager, next"
              :total="50"
              class="mt-4"
          />
        </div>
        <div class="empty" v-else>
          <el-empty image="http://lixinghe.meimeng.eu.org/flower/image/empty.jpeg" image-size="400" description="暂时没有搜索到商品奥~" >
            <el-button type="success" plain @click="goTo">回首页逛逛</el-button>
          </el-empty>
        </div>
        <GuessLike></GuessLike>
      </div>
      <!--商品分列详情-->
    </div>
  </div>
</template>

<script>
import GuessLike from '@/components/commons/GuessLike'
import {onMounted, ref} from 'vue'
import router from "@/router";
export default {
  name: "index",
  setup(){
    let loading = ref(true)

    onMounted(() => {
      timer()
    })

    function timer(){
      setTimeout(()=>{
        loading.value = false
      },2000)
    }

    function goTo(){
      router.push('/')
    }

    return {
      loading,
      goTo
    }
  },
  components:{
    GuessLike
  }
}
</script>

<style scoped lang="scss">
* {
  padding: 0;
  margin: 0;
}
li {
  list-style-type: none;
}
a {
  text-decoration: none;
  color:#737373;
  cursor: pointer;
}
.container {
  width: 1250px;
  margin: 0 auto;
}
.imgshow {
  padding: 20px 0 20px 20px;
  .title_top {
    display: flex;
    align-items: center;
    span {
      margin-left: 20px;
      font-size: 20px;
    }
    div {
      font-size: 20px;
      margin-left: 20px;
    }
  }
}
.goods-detail {
  padding: 50px 0px 0 0px;
  width: 70%;
  display: flex;
  justify-content: center;
  /*让弹性盒的元素以相反的顺序显示，且在必要的时候进行拆行：*/
  flex-flow: wrap;
  text-align: left;
  min-height: 800px;
  position: relative;
  border-right: 1px solid #d0a8d4;
  box-sizing: border-box;
  .goods-detail-item {
    display: inline-block;
    width: 230px;
    text-align: center;
    height: 380px;
    margin: 20px;
    border: 1px solid gainsboro;
    /*box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19);*/
    border-radius: 10px;
    &:hover {
      transition: all 0.3s linear;
      box-shadow:0 0 20px #cccccc;
    }
    .goods-detail-item-top {
      overflow: hidden;
      height: 228px;
      img {
        border-radius: 10px 10px;
        width: 100%;
      }
    }
  }
}
.empty {
  padding: 50px 0px 0 0px;
  width: 70%;
  min-height: 500px;
  border-right: 1px solid #d0a8d4;
}

/*.goods-detail-item:hover {*/
/*  border: 1px solid #C0C4CC;*/
/*  padding: 9px;*/
/*}*/

.price {
  color: orangered;
  font-weight: bolder;
  margin: 10px;
}
.title {
  font-size: 12px;
  margin-top: 20px;
}
.title a:hover {
  color: orangered;
}
.operate {
  margin-top: 20px;
}
.orde {
  padding: 10px 0;
  background: #f1e3e3;
  border-radius: 0 0 10px 10px;
  display: flex;
  padding-left: 30px;
  height: 40px;
  font-size: 16px;
  align-items: center;
  margin-top: 10px;
  div:nth-of-type(4) {
    margin: 0 20px;
    display: flex;
    align-items: center;
    flex-direction: column;
    .up {
      margin-bottom: 6px;
      width: 0;
      height: 0;
      border-bottom: 5px solid skyblue;
      border-right: 5px solid transparent;
      border-left: 5px solid transparent;
    }
    .down{
      width: 0;
      height: 0;
      border-top: 5px solid skyblue;
      border-right: 5px solid transparent;
      border-left: 5px solid transparent;
    }
  }
}
.operate a {
  display: inline-block;
  width: 100px;
  height: 30px;
  line-height: 30px;
  font-size: 14px;
}
.operate a:hover {
  color: orangered;
  background-color: #f6d48b;
}
</style>
